import sensor, image, time
from pyb import LED


LED(1).on()
LED(2).on()
LED(3).on()



sensor.reset()
sensor.set_pixformat(sensor.RGB565)
sensor.set_framesize(sensor.QQVGA)
sensor.set_auto_whitebal(False)
sensor.set_auto_gain(False)
sensor.skip_frames(time = 2000)



clock = time.clock()

x = 75
y = 70
w = 8
h = 8


while(True):
    clock.tick()
    img = sensor.snapshot().lens_corr(1.8)
    sts = img.get_statistics(roi=(x,y,w,h))
    img.draw_rectangle((x,y,w,h), color=(255,0,0))
    print(sts.l_min(),sts.l_max(),sts.a_min(),sts.a_max(),sts.b_min(),sts.b_max())
    #print(clock.fps())




